<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<link rel="stylesheet" href="http://127.0.0.1/cms_edu/Template/default/css/style.css" />
<script type="text/javascript" src="http://127.0.0.1/cms_edu/Template/default/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="http://127.0.0.1/cms_edu/Template/default/js/js.js"></script>
<!--载入hdjs，前面必须有一个jq-->
<link rel="stylesheet" type="text/css" href="http://127.0.0.1/cms_edu/Static/hdjs/hdjs.css"/>
<script src="http://127.0.0.1/cms_edu/Static/hdjs/hdjs.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
	$(function(){
		 $('#regForm').validate({
            username_reg: {
                rule: {
                    required: true,
                     ajax:{url:'<?php echo U("Member/ajaxCheckUser");?>'}
                },
                error: {
                    required: '用户名不能为空',
                    
                },
                success: '验证通过',
                message: '请输入用户名'
            },
	        nickname: {

                rule: {
                    required: true,
                },
 
                error: {
                    required: '昵称不能为空',
                },
       
                success: '验证通过',
  
                message: '请输入昵称'
            },
             password_reg1: {

                rule: {
                    required: true,
                    minlen:6
                },

                error: {
                    required: '密码不能为空',
                    minlen:'密码不得少于6位'
                },

                success: '验证通过',

                message: '请输入密码'
            },
            password_reg2: {

                rule: {
                    required: true,
                    confirm:'password_reg1'
                },

                error: {
                    required: '密码不能为空',
                    confirm:'两次不一样'
                },

                success: '验证通过',

                message: '请再次输入密码'
            },
            code: {

                rule: {
                    required: true,
                    ajax:{url:'<?php echo U("Member/ajaxCheckCode");?>'}
                },

                error: {
                    required: '验证码不能为空',
                },

                success: '验证通过',

                message: '请输入验证码'
            },
		
		});
		
	})
</script>
</head>
<body>
	<!-- 顶部100%灰色区域 -->
	<div id="top_dark_box">
		<!-- 中间1200px宽度区域 -->
		<div id="top_dark">
			<a href=""><img src="http://127.0.0.1/cms_edu/Template/default/images/others/logo.jpg" id="logo" /></a>
			<!-- 导航菜单 -->
			<ul id="menu">
				<li>
					<a href="<?php echo U('index/index');?>">首页</a>
				</li>
				
				<?php
    $topCate=K('Category')->where('pid=0 AND is_show=1')->limit(5)->order('csort ASC')->all();
    foreach ($topCate as $filed):
   //如果是列表页是静态的时候
	if($filed['is_listhtml']){
		$filed['url'] = 'http://127.0.0.1/cms_edu/Static/' . C('index_tpl_style') . '/' . $filed['htmldir'] . '/index.html';
	}else{
		$filed['url'] = U('List/index',array('cid'=>$filed['cid']));
	}
?>

				<li>
					<a href="<?php echo $filed['url'];?>"><?php echo $filed['cname'];?></a>
				</li>
				
<?php
endforeach
?>
				
			</ul>
			<!-- 导航菜单结束 -->
			<!-- 用户登录 -->
			<div id="loginInfo" class='loginInfo'>
				<?php if (empty($hd['session']['uname'])){ ?>
				<a href="javascript:showLoginBox()" class="top_login">用户登录</a>
			<a href="javascript:showRegBox();">注册</a>
			<?php }else{ ?>
			 <span><?php echo $hd['session']['uname'];?></span><a href="<?php echo U('Member/out');?>">退出</a> 
			 <?php } ?>
			</div>
			<!-- 用户登录对应隐藏区域 -->
			<form id="loginForm" action="<?php echo U('Member/login');?>" method="post">
			<div class="login_hide_box">
				<img src="http://127.0.0.1/cms_edu/Template/default/images/sanjiao.gif" alt="" />
				<div class="middle">
					<p>用户名：</p>
					<input type="text" name="username" class="text" />
					<p>密码：</p>
					<input type="password" name="password" class="text" />
					<input type="submit" value="" class="sub" />
				</div>
				<div class="bottom">
					<a  href="javascript:showRegBox();" class="reg">注册</a>
				</div>
			</div>
			</form>
			
			<!-- 用户注册对应隐藏区域 -->
			<form id="regForm" action="<?php echo U('Member/register');?>" method="post">	
			<div class="reg_hide_box">
				<img src="http://127.0.0.1/cms_edu/Template/default/images/sanjiao.gif" alt="" />
				<div class="middle">
					<p>用户名：</p>
					<input type="text" name="username_reg" class="text username" />
					<p>昵称：</p>
					<input type="text" name="nickname" class="text nickname" />
					<p>密码：</p>
					<input type="password" name="password_reg1" class="text password" />
					<p>确认密码：</p>
					<input type="password" name="password_reg2" class="text password" />
					<p>验证码：</p>
					<img src="<?php echo U('Member/code');?>" id="code" onclick="this.src=this.src + '&' + Math.random()"/>
					<input type="text"  name="code" class="text password_d" />
					<input type="submit" value="注册" class="sub" />
				</div>
			</div>
			</form>
		</div>
		<!-- 中间1200px宽度区域结束 -->
	</div>
	<!-- 顶部灰色100%区域结束 -->
	
	<!-- 顶部最新消息区域 -->
	<div id="latest_news_box">
		<div id="latest_news">
			
			<p><span class="title">最新消息：</span>
				<?php
	//如果有分页的话
	if(0){
		$total = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where("is_recycle=0 AND category_cid IN (4)")->count();
		$pageObj = new Page($total,0,5);
		$arcData = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where("is_recycle=0 AND category_cid IN (4)")->limit($pageObj->limit())->order("sendtime DESC")->all();
		$page = $pageObj->show();
	}else{
		$arcData = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where("is_recycle=0 AND category_cid IN (4)")->limit("1")->order("sendtime DESC")->all();
	}
    foreach ($arcData as $filed):
    $filed['url']=U('Content/index',array('aid'=>$filed['aid']));
   //组合分类的url
   $field['curl'] = U('List/index',array('cid'=>$field['cid']));
   
    //评论总数
    $filed['total'] = M('comment')->where("article_aid=" . $filed['aid'])->count();
    
?>

			<a href="<?php echo $filed['url'];?>"><?php echo $filed['title'];?></a></p>
				
<?php
endforeach
?>
		</div>
	</div>
	<!-- 顶部最新消息区域结束 -->

<!-- 顶部最新消息区域结束 -->

	<!-- 主体区域 -->
	<div id="main">
		

		<!-- 左侧区域 -->
		<div class="left">
			<!-- 列表页介绍 -->
			<div class="list_description">列表描述</div>
			<!-- 列表页介绍结束 -->
			<ul class="arc_list">
				<?php
	//如果有分页的话
	if(1){
		$total = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where("is_recycle=0 AND category_cid IN (4)")->count();
		$pageObj = new Page($total,1,5);
		$arcData = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where("is_recycle=0 AND category_cid IN (4)")->limit($pageObj->limit())->order("sendtime DESC")->all();
		$page = $pageObj->show();
	}else{
		$arcData = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where("is_recycle=0 AND category_cid IN (4)")->limit("1000")->order("sendtime DESC")->all();
	}
    foreach ($arcData as $filed):
    $filed['url']=U('Content/index',array('aid'=>$filed['aid']));
   //组合分类的url
   $field['curl'] = U('List/index',array('cid'=>$field['cid']));
   
    //评论总数
    $filed['total'] = M('comment')->where("article_aid=" . $filed['aid'])->count();
    
?>

				<li>
					<div class="pic">
						<a href="<?php echo $filed['url'];?>">
						<img src="http://127.0.0.1/cms_edu/<?php echo $filed['thumb'];?>" style="height:110px;width:150px;" />
					    </a>
					</div>
					<h3><a href="<?php echo $filed['url'];?>"><?php echo $filed['title'];?></a></h3>
					<span class="date"><?php echo date('y-m-d',$filed['sendtime']);?></span>
					<a href="" class="comment"><?php echo $filed['total'];?>条评论</a>
					<span class="browse_number"><?php echo $filed['click'];?>次浏览</span>
					<p class="description"><?php echo $filed['digest'];?></p>
				</li>
				
<?php
endforeach
?>
			</ul>

			<!-- 分页 -->
			<ul class="pagelist">
					<?php echo $page;?>
			</ul>
			<!-- 分页结束 -->
		</div>
		<!-- 左侧区域结束 -->
		<!-- 右侧区域 -->
<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
		<div class="right">
			<div class='hd_title'>
				<strong>标签云</strong>	
			</div>
			<div id="tagBox" class='tags'>
				<?php
if(1000){
	$tagData = K('Tag')->limit('1000')->where('')->all();
}else{
	$tagData = K('Tag')->where('')->all();
}
foreach ($tagData as $filed):
$filed['url'] = U('List/index',array('tid'=>$filed['tid']));
?>

				<a href="<?php echo $filed['url'];?>"><?php echo $filed['tagname'];?></a>	
				
<?php
endforeach
?>		
			</div>
			<div class='hd_title'>
				<strong>热门文章</strong>	
			</div>
			<ul class='arc_list'>
				<?php
	//如果有分页的话
	if(0){
		$total = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where("is_recycle=0 AND attr like '%热门%' AND category_cid IN (4)")->count();
		$pageObj = new Page($total,0,5);
		$arcData = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where("is_recycle=0 AND attr like '%热门%' AND category_cid IN (4)")->limit($pageObj->limit())->order("sendtime DESC")->all();
		$page = $pageObj->show();
	}else{
		$arcData = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where("is_recycle=0 AND attr like '%热门%' AND category_cid IN (4)")->limit("2")->order("sendtime DESC")->all();
	}
    foreach ($arcData as $filed):
    $filed['url']=U('Content/index',array('aid'=>$filed['aid']));
   //组合分类的url
   $field['curl'] = U('List/index',array('cid'=>$field['cid']));
   
    //评论总数
    $filed['total'] = M('comment')->where("article_aid=" . $filed['aid'])->count();
    
?>

					<li>
						<div class='image'>
							<a href="<?php echo $filed['url'];?>">
								<img src="http://127.0.0.1/cms_edu/<?php echo $filed['thumb'];?>
" alt=""/>
							</a>
						</div>
						<h2><a href="<?php echo $filed['url'];?>"><?php echo mb_substr($filed['title'],0,17,'utf-8');?>...</a></h2>
						<p>
							<em><?php echo date('y-m-d',$filed['sendtime']);?></em><span><?php echo $filed['total'];?>条评论</span>
						</p>
					</li>
				
<?php
endforeach
?>
			</ul>
			<div class='hd_title'>
				<strong>推荐文章</strong>	
			</div>
			
			<ul class='arc_list'>
				<?php
	//如果有分页的话
	if(0){
		$total = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where("is_recycle=0 AND attr like '%推荐%' AND category_cid IN (4)")->count();
		$pageObj = new Page($total,0,5);
		$arcData = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where("is_recycle=0 AND attr like '%推荐%' AND category_cid IN (4)")->limit($pageObj->limit())->order("sendtime DESC")->all();
		$page = $pageObj->show();
	}else{
		$arcData = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where("is_recycle=0 AND attr like '%推荐%' AND category_cid IN (4)")->limit("2")->order("sendtime DESC")->all();
	}
    foreach ($arcData as $filed):
    $filed['url']=U('Content/index',array('aid'=>$filed['aid']));
   //组合分类的url
   $field['curl'] = U('List/index',array('cid'=>$field['cid']));
   
    //评论总数
    $filed['total'] = M('comment')->where("article_aid=" . $filed['aid'])->count();
    
?>

				
				<li>
						<div class='image'>
							<a href="<?php echo $filed['url'];?>">
								<img src="http://127.0.0.1/cms_edu/<?php echo $filed['thumb'];?>
" alt=""/>
							</a>
						</div>
						<h2><a href="<?php echo $filed['url'];?>"><?php echo mb_substr($filed['title'],0,17,'utf-8');?>...</a></h2>
						<p>
							<em><?php echo date('y-m-d',$filed['sendtime']);?></em><span><?php echo $filed['total'];?>条评论</span>
						</p>
					</li>
					
			
<?php
endforeach
?>
			</ul>
		</div>
		<!-- 右侧区域结束 -->
<!-- 右侧区域结束 -->

	</div>
	<!-- 主体区域结束 -->
	<!-- 底部浅灰色导航区域 -->
<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
	<div id="bottom_menu_box" style="margin-top:30px;">
		<div class="bottom_menu">
			<?php
    $flink=K('Flink')->where('is_show=1')->limit(2)->all();

    foreach ($flink as $filed):
?>

			<dl>
				<dt><a href="<?php echo $filed['url'];?>"><?php echo $filed['fname'];?></a></dt>
			</dl>
			
<?php
endforeach
?>
		</div>
	</div>
	<!-- 底部浅灰色导航区域结束 -->

	<!-- 底部版权区域 -->
	<div id="bottom_copyright_box">
		<div class="bottom_copyright">
			版权信息
		</div>
	</div>
	<!-- 底部版权区域结束 -->
<!-- 底部版权区域结束 -->
	
</body>
</html>
